import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './assets/css/global.css'
// 导入字体图标
import './assets/fonts/iconfont.css'

// import '@/utile/add'
// 导入
import TreeTable from 'vue-table-with-tree-grid'

// 导入富文本编辑框
import VueQuillFditor from 'vue-quill-editor'
// import 'quill/dist/quill.core.css'
// import 'quill/dist/quill.snow.css'
// import 'quill/dist/quill.bubble.css'

//导入进度条插件
import NProgress from 'nprogress'
// //导入进度条样式
// import 'nprogress/nprogress.css'

// 导入axios
import axios from 'axios'
// 配置请求的根路径
axios.defaults.baseURL = 'https://www.liulongbin.top:8888/api/private/v1/'
axios.interceptors.request.use(config =>{
  //当进入request拦截器，表示发送了请求，我们就开启进度条
  NProgress.start()
  config.headers.Authorization = window.sessionStorage.getItem('token')
  // 在最后必须return
  return config
  
})
 Vue.prototype.$http =axios

Vue.component('tree-table',TreeTable)
Vue.config.productionTip = false



// 定义格式化时间的过滤器
Vue.filter('timeFormat', function (value) {
  var date = new Date(value);
  var YY = date.getFullYear() + '-';
  var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
  var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
  var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
  var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
  var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
  return YY + MM + DD +" "+hh + mm + ss;   

})

Vue.use(VueQuillFditor)

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
